package cc.flyflow.web.controller.process;

import cc.flyflow.biz.service.ITaskService;
import cc.flyflow.common.dto.R;
import cc.flyflow.common.dto.process.TaskParamDto;
import lombok.SneakyThrows;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 任务实例接口
 */
@RestController
@RequestMapping(value = "task")
public class TaskController
{

    @Resource
    private ITaskService taskService;

    /**
     * 完成任务
     *
     * @param completeParamDto
     * @return
     */
    @SneakyThrows
    @PostMapping("completeTask")
    public R completeTask(@RequestBody TaskParamDto completeParamDto)
    {
        return taskService.completeTask(completeParamDto);
    }

    /**
     * 获取任务信息
     *
     * @param taskId 任务id
     * @return
     */
    @GetMapping("getTask")
    public R getTask(String taskId)
    {
        return taskService.getTask(taskId);
    }
}
